export default {
  // Global page headers (https://go.nuxtjs.dev/config-head)
  mode: "universal",
  // server:{
  //   port:3000
  // },
  head: {
    title: '知崖',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '这是一个个性化的网站，分享个人的生活和学习' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }         // / 直接代表static目录
    ]
  },

  // Global CSS (https://go.nuxtjs.dev/config-css)
  css: [
    "~assets/css/index.css",
    "element-ui/lib/theme-chalk/index.css",
  ],

  loading: '~/components/loading.vue',

  // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
  plugins: [
    {
      src: '~/plugins/http',
      ssr: true    //开启后端渲染
    },
    {
      src: "~/plugins/element-ui",
      ssr: true
    },
    { 
      src: '~/plugins/localStorage.js',
      ssr: false }
  ],

  axios: {
    proxy: true,   //开启跨域
    // prefix:"/api"   // 基础路径
  },

 
  proxy: {
    '/api/': {
      // target: 'http://139.155.253.86:5001',
      target: 'http://127.0.0.1:5001',
      changeOrigin: true,
      pathRewrite: {
        '^/api': ''
      }
    },
    '/gateway': {
      // target: 'http://139.155.253.86:5001',
      target: ' https://m.maizuo.com',
      changeOrigin: true,
      // pathRewrite: {
      //   '^/api': ''
      // }
    }
  },

  // Auto import components (https://go.nuxtjs.dev/config-components)
  components: true,

  // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  buildModules: [
  ],

  // Modules (https://go.nuxtjs.dev/config-modules)
  modules: [
    '@nuxtjs/axios',
    'cookie-universal-nuxt'
  ],

  // Build Configuration (https://go.nuxtjs.dev/config-build)
  build: {
    transpile: [/^element-ui/]
  }
}
